/*
 * Pane.h
 *
 *  Created on: Apr 13, 2009
 *      Author: wrice
 */

#ifndef PANECONTROL_H_
#define PANECONTROL_H_
#include "PANEImp.h"
namespace PANEImp {

class PANEElement : public ElementImp, IMPLEMENTS( VisualSegmentForPANE ), IMPLEMENTS( RenderableWithOpenCV ) {
protected:
	friend class PANEDocument;
	PANEElement(DOMString nodeName, PANEDocument * ownerDocument);
public:
	static string AttrNameWidth;
	static string AttrNameHeight;
	static string AttrNameVisible;
	static string AttrNameForegroundColor;
	static string AttrNameBackgroundColor;
	static string AttrNameFontName;
	static string AttrNameFontHeight;
	static string AttrValueVisibleTrue;
	static string AttrValueVisibleFalse;

public: // from VisualSegmentForPANE
	virtual long getTopOffset();
	virtual long getBottomOffset();
	virtual long getLeftOffset();
	virtual long getRightOffset();
	virtual unsigned long getActualWidth( unsigned long availableWidth );
	virtual unsigned long getActualHeight( unsigned long availableWidth );
	virtual bool getVisible();
	virtual unsigned long getForegroundColor();
	virtual unsigned long getBackgroundColor();
	virtual DOMString getFontName();
	virtual DOMString getFontHeight();

public: // From RenderableWithOpenCV
	virtual void requestRepaint();
	virtual bool isRepaintRequested();

public: // new methods
	virtual long getAvailableWidth();
	virtual bool hasDesiredWidth();
	virtual bool hasDesiredHeight();
	virtual unsigned long getWidth();
	virtual unsigned long getHeight();
	virtual void setWidth(unsigned long width);
	virtual void setHeight(unsigned long height);
	virtual void setVisible( bool visible );
	virtual void setFontName( DOMString fontName );
	virtual void setFontHeight( DOMString fontHeight );
	virtual void repainted();

private:
	typedef Tuple< LOKI_TYPELIST_2(unsigned long, unsigned long ) > WidthHeight;
	WidthHeight getActualWidthHeight( unsigned long availableWidth );

private:
	bool repaintRequested_;
};

}

#endif /* PANECONTROL_H_ */
